#include "richeditorwindow.h"
#include "ui_richeditorwindow.h"

RichEditorWindow::RichEditorWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::RichEditorWindow)
{
    ui->setupUi(this);
    QAction * action_insertImage = new QAction(tr("图片"),this);
    connect(action_insertImage,&QAction::triggered,this,&RichEditorWindow::insertImage);
    ui->toolBar->addAction(action_insertImage);
}

void RichEditorWindow::insertImage() {
    QTextImageFormat format;
    format.setName("./ffmpeg.jpg");
    ui->textEdit->textCursor().insertImage(format);
}

RichEditorWindow::~RichEditorWindow()
{
    delete ui;
}
